﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ent;
namespace DAL
{
    public class ThiSinhDAL:clsKetNoi
    {
        dataDataContext dt;
        public int DangNhap(string user, string pass)
        {
            dt = GetKetnoi();
            IEnumerable<ThiSinh> q = dt.ThiSinhs.Where(h => h.MSSV == user);
            int x = 0;
            foreach (ThiSinh item in q)
            {
                if (item.MSSV == user)
                {
                    x = 1;
                    if (item.MATKHAU == pass)
                        return 2;
                }
            }
            return x;
        }
        public ThisinhTbl ThongTinThiSinh(string p1)
        {
            dt = GetKetnoi();
            IEnumerable<ThiSinh> ts = dt.ThiSinhs.Where(h => h.MSSV == p1);
            ThisinhTbl thisinh = new ThisinhTbl();
            foreach (ThiSinh item in ts)
            {
                thisinh.MSSV = item.MSSV;
                thisinh.MatKhau = item.MATKHAU;
                thisinh.TenSV = item.TENSV;


            }
            return thisinh;
        }
    }
}
